﻿using B.MES.Customer.Application.IApplication;
using B.MES.Customer.Domain.DTO;
using B.MES.Customer.Domain;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.MES.Customer.Read.WebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class InconeStatementDTOController : ControllerBase
    {
        private readonly IIncomeStatementApplication  _incomeStatementApplication;

        public InconeStatementDTOController(IIncomeStatementApplication incomeStatementApplication)
        {
            _incomeStatementApplication = incomeStatementApplication;
        }
        /// <summary>
        /// 收入添加
        /// </summary>
        /// <param name="incomeStatement"></param>
        /// <returns></returns>
        /// 
        [HttpPost]
        public IActionResult AddIncomeState(IncomeStatement incomeStatement)
        {
           var result= _incomeStatementApplication.AddIncomeState(incomeStatement);
           return Ok(result);
        }
        /// <summary>
        /// 获取收入信息
        /// </summary>
        /// <param name="PageIndex"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        /// 
        [HttpGet]
        public IActionResult GetIncomeStatement(int PageIndex, int PageSize)
        {
           var result= _incomeStatementApplication.GetIncomeStatement(PageIndex, PageSize);
            return Ok(result);
        }
        /// <summary>
        /// 获取收入类型
        /// </summary>
        /// <returns></returns>
        /// 
        
        [HttpGet]   
        public   IActionResult GetIncomeType()
        {
            var result =  _incomeStatementApplication.GetIncomeType();
            return Ok(result); 
            
        }
        /// <summary>
        /// 修改收入明细
        /// </summary>
        /// <param name="incomeStatement"></param>
        /// <returns></returns>
        /// 
        [HttpPut]
        public IActionResult UpdateIncomeStatement(IncomeStatement incomeStatement)
        {
           var result = _incomeStatementApplication.UpdateIncomeStatement(incomeStatement);
           return Ok(result);
        }
        /// <summary>
        /// 删除收入明细
        /// </summary>
        /// <param name="incomeId"></param>
        /// <returns></returns>
        /// 
        [HttpDelete]
        public IActionResult DeleteIncomeStatement(int incomeId)
        {
            var resutl = _incomeStatementApplication.DeleteIncomeStatement(incomeId);
            return Ok(resutl);
        }
        /// <summary>
        /// 批量删除收入明细
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        /// 
        [HttpPut]
        public IActionResult DeletesIncomeStatement(List<IncomeStatement> list)
        {
           var result= _incomeStatementApplication.DeletesIncomeStatement(list);
            return Ok(result);
        }
        /// <summary>
        /// 获取收入明细
        /// </summary>
        /// <param name="incomeId"></param>
        /// <returns></returns>
        /// 
        [HttpGet]
        public IActionResult EditIncomeStatement(int incomeId)
        {
           var result = _incomeStatementApplication.EditIncomeStatement(incomeId);
            return Ok(result);
        }
    }
}
